package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 邀请类型：1-邀请商户，2-邀请经纪人，3-一级经纪人邀请二级经纪人
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum InviteTypeEnum {

    INVITE_MERCHANT(1, "邀请商户"),
    INVITE_AGENT(2, "邀请经纪人"),
    INVITE_SUB_AGENT(3, "邀请二级经纪人"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    InviteTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static InviteTypeEnum typeOf(Integer value) {
        InviteTypeEnum[] values = InviteTypeEnum.values();
        for (InviteTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static InviteTypeEnum typeOf(String name) {
        InviteTypeEnum[] values = InviteTypeEnum.values();
        for (InviteTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
